package com.zhuxiaomei.controller;

import com.zhuxiaomei.utils.MinioUtils;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author hxm
 * @date 2024/11/17 23:34
 * @description
 */
@RestController
@Slf4j
public class FilesController {

    @Resource
    private MinioUtils minioUtils;

    @PostMapping("/upload")
    public String uploadFile(@RequestParam("file") MultipartFile multipartFile){
        String fileName = minioUtils.upload(multipartFile);
        return fileName;
    }
}
